package com.newtouch.avmarketing.mgr.modules.avmarkrting.repo;

import com.newtouch.avmarketing.mgr.modules.avmarkrting.entity.DoubleConfiguration;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface DoubleConfigurationRepo extends JpaRepository<DoubleConfiguration,Long>,
        JpaSpecificationExecutor<DoubleConfiguration> {

    /**
     * 通过步骤序号查找双录步骤
     * @param id
     * @return
     */
    @Query(value = "select * from double_configuration " +
            "where is_deleted = '0' and id = ?1",nativeQuery = true)
    DoubleConfiguration findByIds(Long id);
    /**
     * 通过步骤序号删除双录步骤
     * @param id
     * @return
     */
    @Query(value = "update double_configuration set is_deleted ='1' " +
            "where is_deleted = '0' and id = ?1",nativeQuery = true)
    @Modifying
    int deleteConfigurationById(Long id);

}
